package org.jeecg.modules.apiacl.service.impl;

import org.jeecg.modules.apiacl.entity.TaxApiaclAuthorize;
import org.jeecg.modules.apiacl.mapper.TaxApiaclAuthorizeMapper;
import org.jeecg.modules.apiacl.service.ITaxApiaclAuthorizeService;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;

/**
 * @Description: 对外开放接口授权管理
 * @Author: jeecg-boot
 * @Date:   2023-08-02
 * @Version: V1.0
 */
@Service
public class TaxApiaclAuthorizeServiceImpl extends ServiceImpl<TaxApiaclAuthorizeMapper, TaxApiaclAuthorize> implements ITaxApiaclAuthorizeService {

    /***
     * 对接口调用进行校验权限
     * @param app_key
     * @param app_secret
     * @return
     */
    public TaxApiaclAuthorize authorize(String app_key, String app_secret){
      List<TaxApiaclAuthorize> authorizeList=this.lambdaQuery().eq(TaxApiaclAuthorize::getAppKey,app_key).eq(TaxApiaclAuthorize::getAppSecret,app_secret).list();
      if(authorizeList!=null&&authorizeList.size()>0){
          return authorizeList.get(0);
      }else {
          return null;
      }
    }
}
